//
//  LoginViewController.m
//  诗韵
//
//  Created by Song on 2018/3/19.
//  Copyright © 2018年 Song. All rights reserved.
//


#import "LoginViewController.h"
#import "SHIYUNTabBarController.h"

@interface LoginViewController ()
- (IBAction)login:(id)sender;
- (IBAction)back:(id)sender;
@property (weak, nonatomic) IBOutlet UITextField *num;
@property (weak, nonatomic) IBOutlet UITextField *pwd;
@property (weak, nonatomic) IBOutlet UIButton *loginBtn;

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChange) name:UITextFieldTextDidChangeNotification object:self.num];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChange) name:UITextFieldTextDidChangeNotification object:self.pwd];
}

-(void)textChange {
    self.loginBtn.enabled = (self.num.text.length && self.pwd.text.length);
}

- (IBAction)login:(id)sender {
    
    NSLog(@"login");
    
    SHIYUNTabBarController *tabbar = [[SHIYUNTabBarController alloc] init];
    
//    [self.navigationController pushViewController:tabbar animated:YES];
//    [self presentModalViewController:tabbar animated:YES];
    [self presentViewController:tabbar animated:YES completion:nil];
    
    NSLog(@"login -- ");
}

- (IBAction)back:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
@end
